<template>
  <div class="container">
    <div v-for="item in examList" class="exam-item">
      <h2 class="exam-item-title">{{item.kcname}}</h2>
      <div class="exam-item-bottom">
        <div class="exam-total">共{{item.pp_count}}张（{{item.sy_count}}张考完）</div>
        <router-link class="btn-to-exam" :to="{path:'/examinationList',query: {id: item.id}}" tag="button">进入考场</router-link>
      </div>
    </div>
    <div v-if="examList.length == 0" class="nodata">--- 暂无数据 ---</div>
    <Footer></Footer>
  </div>
</template>

<script>
  import util from '@/common/util';
  export default {
    data() {
      return {
        kcdx: '',
        idcard: '',
        examList:[],
      }
   },
    created() {
      let that = this;
      if(util.storage.get('userinfo')){
        that.kcdx = util.storage.get('userinfo').kcdx;
        that.idcard = util.storage.get('userinfo').idcard;
      }
      console.log('kcdx',that.kcdx)
      that.getExamList(); // 调用考场列表
    },
    methods:{
      getExamList() {  //获取考场列表
        let that = this;
        that.$toast.loading({
          message: '加载中...'
        });
        that.$api.post('/mobile/Kcks/index',{'user':{'kcdx':that.kcdx, 'idcard':that.idcard}}, r => {
          console.log('考场列表：',r)
          that.examList = r.data;
          that.$toast.clear();
        })
      },
    }
  }
</script>

<style scoped>

</style>
